<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
    <link rel="stylesheet" href="../src/josh-ui.css">
    <title>JoshUi-Toast提示组件</title>
    <style>
        .ju-btn + .ju-btn {
            margin-top: 1rem; 
        }
    </style>
</head>
<body>
    <div class="ju-content">
        <h1 class="ju-panel-title">Toast提示组件</h1>
        <div class="ju-panel-body">
            <a class="ju-btn" id="js-show-toash-loading">加载中提示</a>
            <a class="ju-btn" id="js-show-toash-success">成功提示</a>
        </div>
    </div>
    <div class="ju-toast" id="js-toast-loading">
        <i class="fa fa-spinner fa-spin ju-toast-icon"></i>
        <p class="ju-toast-info">操作进行中</p>
    </div>
    <div class="ju-toast" id="js-toast-success">
        <i class="fa fa-check ju-toast-icon"></i>
        <p class="ju-toast-info">操作成功</p>
    </div>
</body>
    <script>
        window.onload = () => {
            //显示加载中的Toast
            document.getElementById('js-show-toash-loading').onclick = (event) => {
                let toastEle = document.getElementById('js-toast-loading');
                toastEle.classList.add('show');
                setTimeout(() => {
                    toastEle.classList.remove('show');
                }, 2e3);
            };

            //显示加载成功的Toast
            document.getElementById('js-show-toash-success').onclick = (event) => {
                let toastEle = document.getElementById('js-toast-success');
                toastEle.classList.add('show');
                setTimeout(() => {
                    toastEle.classList.remove('show');
                }, 2e3);
            }
        }
    </script>
</html>